<template>
  <div class="elm-edit">
  <elm-page-bb>
    <el-form ref="model" :model="model" size="small" label-width="120px">
      <elm-row>
        <el-form-item label="名称" prop="name" :rules="[{ required: true, message: '名称必须填写'}]">
          <el-input type="name" v-model="model.name"></el-input>
        </el-form-item>
        <el-form-item label="上级">
          <elm-select-tree v-model="model.pid" url="/business/pmis/pj/type/stage/GetTree"
                           :url-data="{pj_type_id:model.pj_type_id}"
                           path-url="/business/pmis/pj/type/stage/GetPath"></elm-select-tree>
        </el-form-item>
      </elm-row>
      <elm-row>
        <el-form-item label="顺序" prop="sort" :rules="[{ required: true, message: '顺序必须填写'},{ type: 'number', message: '顺序必须为数字'}]">
          <el-input v-model.number="model.sort"></el-input>
        </el-form-item>
        <el-form-item label="是否重要节点">
          <el-switch v-model="model.important" active-color="#13ce66" inactive-color="#ff4949" active-value="是" inactive-value="否"></el-switch>
        </el-form-item>
      </elm-row>
      <el-form-item label="备注">
        <el-input type="textarea" v-model="model.remark" :rows="2"></el-input>
      </el-form-item>
    </el-form>
<!--    <el-card shadow="hover" style="margin: 5px 0">-->
<!--      <div slot="header">-->
<!--        <span>采集信息</span>-->
<!--        <elm-open-button url="ei_extend" title="个人技能"   width="900" height="700" :data="{ei_id: model.id,type:'个人技能'}" type="text"  style="float: right; padding: 3px 0">编辑</elm-open-button>-->
<!--      </div>-->
<!--      <el-tag :items="cjxxs" style="margin-left: -3px;" width="100%">-->
<!--      </el-tag>-->
<!--    </el-card>-->
    <template #bottom>
      <el-button type="success" size="small" @click="submit" model.>立即保存</el-button>
      <el-button size="small" @click="close">取消</el-button>
    </template>
  </elm-page-bb>
  </div>
</template>

<script>
export default {
  extends: elmVueBase,
  data() {
    return {
      model: {
        pid: elm.dialog.request.pid,
        pj_type_id: elm.dialog.request.pj_type_id,
        important:"否"
      },
      cjxxs:[],
      cjxx: {},
      xzx:null
    }
  },
  created() {
  },
  methods: {
    addxzx()
    {

    },
    async submit() {
      await this.$refs["model"].validate();
      var res = await elm.post('/business/pmis/pj/type/stage/Upsert', this.model);
      if (res == true) {
        this.close();
        this.v('保存成功。');
        this.request.callVue.treebinding();
      }
      else {
        this.error('保存失败，请稍后尝试。');
      }
    }
  }
}
</script>

<style scoped>
</style>